package fun.fykj.liu.controller;


import fun.fykj.liu.cofig.SysConstant;
import fun.fykj.liu.dto.ClockIn;
import fun.fykj.liu.model.Result;
import fun.fykj.liu.service.IRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.Map;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author DongJin
 * @since 2020-01-16
 */
@RestController
@RequestMapping(SysConstant.API + "/record")
public class RecordController {

    @Autowired
    private IRecordService recordService;

    //根据日期获取打卡记录
    @PostMapping("/getNotByDay")
    Result getNotByDay(@RequestBody Map<String, Object> map) {
        return recordService.getNotByDay((String) map.get("day"));
    }

    //打卡
    @PostMapping("/clock")
    Result clock(@RequestBody @Valid ClockIn clockIn) {
        return recordService.clock(clockIn);
    }
}
